package com.base.cn.platform.os.controller.teacher;

import com.base.cn.platform.os.common.utils.result.ResultUtil;
import com.base.cn.platform.os.controller.cmmon.ApiBaseController;
import com.base.cn.platform.os.service.manage.teacher.SysTeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;

/**
 * 老师数据接口Controller
 *
 * @author s.li
 * @create 2018-09-06-15:43
 */
@RestController
@RequestMapping("/api/teacher")
public class ApiTeacherController extends ApiBaseController {

    @Autowired
    private SysTeacherService sysTeacherService;

    /**
     * 老师列表接口
     * @param currentPage
     * @return
     */
    @RequestMapping("/getTeacherList")
    public Map<String,Object> getTeacherList(@RequestParam(value = "currentPage",required = false) int currentPage){
        Map<String,Object> params = new HashMap<>();
        params.put("status",1);
        params.put("teacherIdentity","1"); //查询讲师
        Map<String,Object> dataMap = sysTeacherService.findWebTeacherListPage(params,currentPage,10,false,false,false);
        return ResultUtil.SUCCESS(dataMap);
    }

    /**
     * 老师详情接口
     * @param teacherId 老师ID
     * @return Map<String,Object>
     */
    @RequestMapping("/getTeacherInfo")
    public Map<String,Object> getTeacherInfo(@RequestParam("teacherId")BigDecimal teacherId){
        Map<String,Object> teacher = sysTeacherService.findSysTeacherById(teacherId,false,false,false,false,false);
        return ResultUtil.SUCCESS(teacher);
    }
}
